package com.example.demo.controller;

import com.example.demo.service.UserService;
import com.example.demo.utils.DoubleToIntUtil;
//import com.example.demo.utils.StringUtil;
import com.example.demo.utils.StringUtil;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;


@RestController
public class IndexController {

    @Resource
    UserService userService;

    @GetMapping("/")
    public String getMethodName() {
        return "Hello World!";
    }

    @GetMapping("/test")
    public String get() {
        double doubleValue = 123.45;
        // 调用 Kotlin 工具类的方法
        String intValue = DoubleToIntUtil.INSTANCE.convertDoubleToInt(doubleValue);
        String userId = userService.getUserById(1L);
        String str = userId + "转换后的整数值: " + intValue;
        StringUtil stringUtil = new StringUtil();
        List<String> strings = stringUtil.convertDoubleToInt(str);
        return String.join("|||", strings);
    }
}
